VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClsUsuario"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'clase usuario
Option Explicit

Public WithEvents orset As ClsRecordset
Attribute orset.VB_VarHelpID = -1

Public Event DataChanged()

Public codigo As String
Public nombre As String
Public clave As String
Public nombre_completo As String
Public bloqueado As Boolean
Public tipo_id As String
Public tipoUsuario As ClsTipoUsuario

Private Sub Class_Initialize()
    Set orset = New ClsRecordset
    Set tipoUsuario = New ClsTipoUsuario
    orset.setCampos dbCampos(usu)
    orset.setTablas Array(usu)
End Sub
Private Sub Class_Terminate()
    Set orset = Nothing
End Sub
Public Sub consulta()
    orset.consulta
End Sub
Public Sub consultaGral(campos As Variant)
    orset.consultaGral campos
End Sub
Public Sub consultaDatos(codig As String)
    orset.consulta Array(usu_id & "=" & codig)
    orset.CierraRec
End Sub
Public Sub valida(nombre As String, clave As String)
    orset.consulta Array(usu_nombre & "='" & Strings.UCase$(nombre) & "'", _
                         usu_clave & "='" & UCase$(clave) & "'")
End Sub
Public Sub Nuevo(newNombre As String, newClave As String, newNombreCompleto As String, newBloqueado As String, newTipoUsuarioCod As String)
    orset.sInsert Array("", newTipoUsuarioCod, newNombre, newClave, newNombreCompleto, newBloqueado)
End Sub
Public Sub Modificar(codig As String, newNombre As String, newClave As String, newNombreCompleto As String, newBloqueado As String, newTipoUsuarioCod As String)
    orset.sUpdate Array(codig, newTipoUsuarioCod, newNombre, newClave, newNombreCompleto, newBloqueado)
End Sub
Public Sub Borrar(codig As String)
    orset.sDelete Array(usu_id & "=" & codig)
End Sub
Private Sub Reload_members()
    With orset
        codigo = .getDato(usu_id)
        nombre = .getDato(usu_nombre)
        clave = .getDato(usu_clave)
        nombre_completo = .getDato(usu_nombre_completo)
        bloqueado = .getDato(usu_bloqueado)
        tipo_id = .getDato(usu_tus_id)
        If tipo_id <> "" Then
            tipoUsuario.consultaDatos tipo_id
        Else
            tipoUsuario.codigo = ""
        End If
    End With
    'cargando tipo
    RaiseEvent DataChanged
End Sub

Private Sub orset_DataChanged()
    Reload_members
End Sub
